package com.laolang.shop.modules.front.web.api;

import com.laolang.shop.common.core.domain.SimpleAjax;
import com.laolang.shop.modules.auth.annotation.Auth;
import com.laolang.shop.modules.front.logic.api.AuthApiLogic;
import com.laolang.shop.modules.front.pojo.dto.AuthRegisterDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author khlbat
 * @version 1.0
 * @date 2020/11/1 20:46
 */
@RequestMapping("api/auth")
@RestController
public class AuthApiController {

    @Autowired
    private AuthApiLogic authApiLogic;

    @Auth(requireLogin = false)
    @PostMapping("register")
    public SimpleAjax<Boolean> register(@RequestBody AuthRegisterDto dto) {
        authApiLogic.register(dto.getPhone(), dto.getPwd());
        return SimpleAjax.ok();
    }
}
